#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    int maxSubArray(vector<int>& nums)
    {
        int maxSumPre = 0, maxSumCur = 0;
        int res = INT32_MIN;
        for(int i = 0; i < nums.size(); ++i)
        {
            maxSumCur = max(maxSumPre + nums[i], nums[i]);
            maxSumPre = maxSumCur;
            res = max(res, maxSumCur);
        }
        return res;
    }
};

void test1()
{
  vector<int> v{-2,1,-3,4,-1,2,1,-5,4};
  Solution().maxSubArray(v);
}

void test2()
{
  int a = 10;
  //printf("%d\n", a);
  printf("%Q\n");
}

int main()
{
  //test1();
  test2();
  return 0;
}
